home *** CD-ROM | disk | FTP | other *** search
-
- (*
- ** General Text unit
- **
- ** - Includes low-level video-writes
- ** - No snow-checking is performed
- ** - VGA is assumed
- ** - All routines are zero-based
- ** - Autodetects current video mode and screen location
- **
- ** By Bas van Gaalen
- *)
-
- unit u_txt;
-
- interface
-
- const
- on=true;
- off=false;
-
- black=0;
- blue=1;
- green=2;
- cyan=3;
- red=4;
- magenta=5;
- brown=6;
- lightgray=7;
- darkgray=8;
- lightblue=9;
- lightgreen=10;
- lightcyan=11;
- lightred=12;
- lightmagenta=13;
- yellow=14;
- white=15;
- blink=128;
- _blue=blue shl 4;
- _green=green shl 4;
- _cyan=cyan shl 4;
- _red=red shl 4;
- _magenta=magenta shl 4;
- _brown=brown shl 4;
- _lightgray=lightgray shl 4;
-
- mda=0;
- cga=1;
- ega=2;
- ega_mono=3;
- vga=4;
- vga_mono=5;
- mcga=6;
- mcga_mono=7;
-
- viderror:byte=0;
-
- var
- color:boolean; { True when colorcard detected }
- v_columns, { Number of Columns. Set at Init }
- v_lines, { Number of Lines. Set at Init }
- vidcard:byte; { Code for active videocard }
- v_vidseg:word; { Segmentaddress of video-RAM }
- v_pageinmem:boolean; { screenpage saved in memory }
-
- function rows:byte; { Number of rows }
- function cols:byte; { Number of Columns }
- procedure setcolumns; { updates v_columns variable }
- procedure setlines; { updates v_lines variable }
- procedure clrscr; { clear current videobuffer - any txt-resolution }
- procedure placecursor(x,y:byte); { a-la gotoxy, but zero-based }
- function getx:byte; { a-la wherex, ditto }
- function gety:byte; { a-la wherey, ditto }
- function getmode:word; { get video mode }
- procedure setmode(mode:word); { simple setvidmode - also check VGA-unit }
- procedure txt_lines(nr:byte); { set number of lines: 12,14,21,25,28,43,50 }
- procedure setblink(state:boolean); { set blink-state: on/off }
- procedure txt_setrgb(c,r,g,b:byte); { set rgb-intensities, text equivalent }
- procedure txt_getrgb(c:byte; var r,g,b:byte); { get rgb-intensities }
- procedure dspat(str:string; col:integer; row,attr:byte); { display string }
- procedure dsptxt(str:string; x:integer; y:byte); { display text only no attr }
- procedure dspchar(c:char; x,y,col:byte); { display one char only }
- procedure dspmul(s:string; x:integer; y:byte); { disp. multicolor text }
- procedure drawbox(xs,ys,xe,ye,attr:byte); { drawbox }
- procedure setcursorshape(shape:word); { low-level set shape of cursor }
- function getcursorshape:word; { low-level get shape of cursor }
- procedure linecursor; { set underscore-cursor any resolution }
- procedure halfcursor; { set half block (insert) cursor, ditto }
- procedure blockcursor; { set full block cursor, ditto }
- procedure cursoroff; { cursor off }
- procedure cursoron; { cursor on }
- procedure setscr; { save current screen }
- procedure getscr; { restore last screen }
- procedure scrolly(dir:char; x1,y1,x2,y2,col:byte); { scroll vertical }
- procedure scrolltexty(dir:char; x1,y1,x2,y2:byte); { scroll text only - v }
- procedure filltext(dir:char; x1,y1,x2,y2,col:byte); { fill area with char }
- procedure fillattr(x1,y1,x2,y2,col:byte); { fill area with color }
- function getattr(x,y:word):byte; { get attribute at coordinate }
-
- implementation
-
-